'use strict';

const Controller = require('egg').Controller;
var cheerio = require('cheerio');

var path = require('path')
var childProcess = require('child_process')
var phantomjs = require('phantomjs')
var binPath = phantomjs.path
// var page = require('webpage').create();

class SpiderController extends Controller {
  /**
   *
   *
   * @memberof HomeController
   */
  async get_data() {
   
    page.open('http://www.baidu.com/', function (status) {
        var data;
        if (status === 'fail') {
            console.log('open page fail!');
        } else {
            console.log(page.content);//打印出HTML内容
        }
        page.close();//关闭网页
        phantom.exit();//退出phantomjs命令行
    });


        
  }

}

module.exports = SpiderController;
